const cloud = require('wx-server-sdk')

cloud.init({
    env:"agriculture-4g9roniha194f9d1"
})
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
    var num = event.num;
    var page = event.page;
    var type = event.type;

    return await db.collection('tool').where({
        type:db.RegExp({
          regexp:'^.*'+type,
        }),
      }).skip(page).limit(num).get()
    
}